
bin/kernel:     file format elf32-i386


Disassembly of section .text:

00100000 <kern_init>:
#include <console.h>

int kern_init(void) __attribute__((noreturn));

int kern_init(void) 
{
  100000:	55                   	push   %ebp
  100001:	89 e5                	mov    %esp,%ebp
  100003:	83 ec 28             	sub    $0x28,%esp
	extern char edata[], end[];
	memset(edata, 0, end - edata);
  100006:	ba 08 21 10 00       	mov    $0x102108,%edx
  10000b:	b8 fc 20 10 00       	mov    $0x1020fc,%eax
  100010:	89 d1                	mov    %edx,%ecx
  100012:	29 c1                	sub    %eax,%ecx
  100014:	89 c8                	mov    %ecx,%eax
  100016:	89 44 24 08          	mov    %eax,0x8(%esp)
  10001a:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  100021:	00 
  100022:	c7 04 24 fc 20 10 00 	movl   $0x1020fc,(%esp)
  100029:	e8 64 0d 00 00       	call   100d92 <memset>

	cons_init();				// init the console
  10002e:	e8 bb 05 00 00       	call   1005ee <cons_init>

	const char *message = "(THU.CST) os is loading ...";
  100033:	c7 45 f4 bc 0e 10 00 	movl   $0x100ebc,-0xc(%ebp)
	cprintf("[%d]%s\n", strlen(message), message);
  10003a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  10003d:	89 04 24             	mov    %eax,(%esp)
  100040:	e8 ef 0c 00 00       	call   100d34 <strlen>
  100045:	8b 55 f4             	mov    -0xc(%ebp),%edx
  100048:	89 54 24 08          	mov    %edx,0x8(%esp)
  10004c:	89 44 24 04          	mov    %eax,0x4(%esp)
  100050:	c7 04 24 d8 0e 10 00 	movl   $0x100ed8,(%esp)
  100057:	e8 58 00 00 00       	call   1000b4 <cprintf>

	while (1);
  10005c:	eb fe                	jmp    10005c <kern_init+0x5c>
  10005e:	90                   	nop
  10005f:	90                   	nop

00100060 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void cputch(int c, int *cnt) 
{
  100060:	55                   	push   %ebp
  100061:	89 e5                	mov    %esp,%ebp
  100063:	83 ec 18             	sub    $0x18,%esp
	cons_putc(c);
  100066:	8b 45 08             	mov    0x8(%ebp),%eax
  100069:	89 04 24             	mov    %eax,(%esp)
  10006c:	e8 a4 05 00 00       	call   100615 <cons_putc>
	(*cnt) ++;
  100071:	8b 45 0c             	mov    0xc(%ebp),%eax
  100074:	8b 00                	mov    (%eax),%eax
  100076:	8d 50 01             	lea    0x1(%eax),%edx
  100079:	8b 45 0c             	mov    0xc(%ebp),%eax
  10007c:	89 10                	mov    %edx,(%eax)
}
  10007e:	c9                   	leave  
  10007f:	c3                   	ret    

00100080 <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int vcprintf(const char *fmt, va_list ap) 
{
  100080:	55                   	push   %ebp
  100081:	89 e5                	mov    %esp,%ebp
  100083:	83 ec 28             	sub    $0x28,%esp
	int cnt = 0;
  100086:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
	vprintfmt((void*)cputch, &cnt, fmt, ap);
  10008d:	b8 60 00 10 00       	mov    $0x100060,%eax
  100092:	8b 55 0c             	mov    0xc(%ebp),%edx
  100095:	89 54 24 0c          	mov    %edx,0xc(%esp)
  100099:	8b 55 08             	mov    0x8(%ebp),%edx
  10009c:	89 54 24 08          	mov    %edx,0x8(%esp)
  1000a0:	8d 55 f4             	lea    -0xc(%ebp),%edx
  1000a3:	89 54 24 04          	mov    %edx,0x4(%esp)
  1000a7:	89 04 24             	mov    %eax,(%esp)
  1000aa:	e8 94 07 00 00       	call   100843 <vprintfmt>
	return cnt;
  1000af:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  1000b2:	c9                   	leave  
  1000b3:	c3                   	ret    

001000b4 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int cprintf(const char *fmt, ...) 
{
  1000b4:	55                   	push   %ebp
  1000b5:	89 e5                	mov    %esp,%ebp
  1000b7:	83 ec 28             	sub    $0x28,%esp
	va_list ap;
	int cnt;
	va_start(ap, fmt);
  1000ba:	8d 45 08             	lea    0x8(%ebp),%eax
  1000bd:	83 c0 04             	add    $0x4,%eax
  1000c0:	89 45 f0             	mov    %eax,-0x10(%ebp)
	cnt = vcprintf(fmt, ap);
  1000c3:	8b 45 08             	mov    0x8(%ebp),%eax
  1000c6:	8b 55 f0             	mov    -0x10(%ebp),%edx
  1000c9:	89 54 24 04          	mov    %edx,0x4(%esp)
  1000cd:	89 04 24             	mov    %eax,(%esp)
  1000d0:	e8 ab ff ff ff       	call   100080 <vcprintf>
  1000d5:	89 45 f4             	mov    %eax,-0xc(%ebp)
	va_end(ap);
	return cnt;
  1000d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  1000db:	c9                   	leave  
  1000dc:	c3                   	ret    

001000dd <cputchar>:

/* cputchar - writes a single character to stdout */
void cputchar(int c) 
{
  1000dd:	55                   	push   %ebp
  1000de:	89 e5                	mov    %esp,%ebp
  1000e0:	83 ec 18             	sub    $0x18,%esp
	cons_putc(c);
  1000e3:	8b 45 08             	mov    0x8(%ebp),%eax
  1000e6:	89 04 24             	mov    %eax,(%esp)
  1000e9:	e8 27 05 00 00       	call   100615 <cons_putc>
}
  1000ee:	c9                   	leave  
  1000ef:	c3                   	ret    

001000f0 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int cputs(const char *str) 
{
  1000f0:	55                   	push   %ebp
  1000f1:	89 e5                	mov    %esp,%ebp
  1000f3:	83 ec 28             	sub    $0x28,%esp
	int cnt = 0;
  1000f6:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
	char c;
	while ((c = *str ++) != '\0') 
  1000fd:	eb 13                	jmp    100112 <cputs+0x22>
	{
		cputch(c, &cnt);
  1000ff:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
  100103:	8d 55 f0             	lea    -0x10(%ebp),%edx
  100106:	89 54 24 04          	mov    %edx,0x4(%esp)
  10010a:	89 04 24             	mov    %eax,(%esp)
  10010d:	e8 4e ff ff ff       	call   100060 <cputch>
 * */
int cputs(const char *str) 
{
	int cnt = 0;
	char c;
	while ((c = *str ++) != '\0') 
  100112:	8b 45 08             	mov    0x8(%ebp),%eax
  100115:	0f b6 00             	movzbl (%eax),%eax
  100118:	88 45 f7             	mov    %al,-0x9(%ebp)
  10011b:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
  10011f:	0f 95 c0             	setne  %al
  100122:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  100126:	84 c0                	test   %al,%al
  100128:	75 d5                	jne    1000ff <cputs+0xf>
	{
		cputch(c, &cnt);
	}
	cputch('\n', &cnt);
  10012a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  10012d:	89 44 24 04          	mov    %eax,0x4(%esp)
  100131:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  100138:	e8 23 ff ff ff       	call   100060 <cputch>
	return cnt;
  10013d:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
  100140:	c9                   	leave  
  100141:	c3                   	ret    
  100142:	90                   	nop
  100143:	90                   	nop

00100144 <delay>:
#include <stdio.h>
#include <string.h>

/* stupid I/O delay routine necessitated by historical PC design flaws */
static void
delay(void) {
  100144:	55                   	push   %ebp
  100145:	89 e5                	mov    %esp,%ebp
  100147:	83 ec 10             	sub    $0x10,%esp
  10014a:	66 c7 45 f0 84 00    	movw   $0x84,-0x10(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100150:	0f b7 45 f0          	movzwl -0x10(%ebp),%eax
  100154:	89 c2                	mov    %eax,%edx
  100156:	ec                   	in     (%dx),%al
  100157:	88 45 f3             	mov    %al,-0xd(%ebp)
	return data;
  10015a:	66 c7 45 f4 84 00    	movw   $0x84,-0xc(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100160:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
  100164:	89 c2                	mov    %eax,%edx
  100166:	ec                   	in     (%dx),%al
  100167:	88 45 f7             	mov    %al,-0x9(%ebp)
	return data;
  10016a:	66 c7 45 f8 84 00    	movw   $0x84,-0x8(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100170:	0f b7 45 f8          	movzwl -0x8(%ebp),%eax
  100174:	89 c2                	mov    %eax,%edx
  100176:	ec                   	in     (%dx),%al
  100177:	88 45 fb             	mov    %al,-0x5(%ebp)
	return data;
  10017a:	66 c7 45 fc 84 00    	movw   $0x84,-0x4(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100180:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
  100184:	89 c2                	mov    %eax,%edx
  100186:	ec                   	in     (%dx),%al
  100187:	88 45 ff             	mov    %al,-0x1(%ebp)
	inb(0x84);
	inb(0x84);
	inb(0x84);
	inb(0x84);
}
  10018a:	c9                   	leave  
  10018b:	c3                   	ret    

0010018c <cga_init>:
static uint16_t addr_6845;

/* TEXT-mode CGA/VGA display output */

static void
cga_init(void) {
  10018c:	55                   	push   %ebp
  10018d:	89 e5                	mov    %esp,%ebp
  10018f:	83 ec 20             	sub    $0x20,%esp
	volatile uint16_t *cp = (uint16_t *)CGA_BUF;
  100192:	c7 45 e4 00 80 0b 00 	movl   $0xb8000,-0x1c(%ebp)
	uint16_t was = *cp;
  100199:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  10019c:	0f b7 00             	movzwl (%eax),%eax
  10019f:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
	*cp = (uint16_t) 0xA55A;
  1001a3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  1001a6:	66 c7 00 5a a5       	movw   $0xa55a,(%eax)
	if (*cp != 0xA55A) {
  1001ab:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  1001ae:	0f b7 00             	movzwl (%eax),%eax
  1001b1:	66 3d 5a a5          	cmp    $0xa55a,%ax
  1001b5:	74 12                	je     1001c9 <cga_init+0x3d>
		cp = (uint16_t*)MONO_BUF;
  1001b7:	c7 45 e4 00 00 0b 00 	movl   $0xb0000,-0x1c(%ebp)
		addr_6845 = MONO_BASE;
  1001be:	66 c7 05 02 21 10 00 	movw   $0x3b4,0x102102
  1001c5:	b4 03 
  1001c7:	eb 13                	jmp    1001dc <cga_init+0x50>
	} else {
		*cp = was;
  1001c9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  1001cc:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
  1001d0:	66 89 10             	mov    %dx,(%eax)
		addr_6845 = CGA_BASE;
  1001d3:	66 c7 05 02 21 10 00 	movw   $0x3d4,0x102102
  1001da:	d4 03 
	}

	// Extract cursor location
	uint32_t pos;
	outb(addr_6845, 14);
  1001dc:	0f b7 05 02 21 10 00 	movzwl 0x102102,%eax
  1001e3:	0f b7 c0             	movzwl %ax,%eax
  1001e6:	66 89 45 f4          	mov    %ax,-0xc(%ebp)
  1001ea:	c6 45 f3 0e          	movb   $0xe,-0xd(%ebp)
			: "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
  1001ee:	0f b6 45 f3          	movzbl -0xd(%ebp),%eax
  1001f2:	0f b7 55 f4          	movzwl -0xc(%ebp),%edx
  1001f6:	ee                   	out    %al,(%dx)
	pos = inb(addr_6845 + 1) << 8;
  1001f7:	0f b7 05 02 21 10 00 	movzwl 0x102102,%eax
  1001fe:	83 c0 01             	add    $0x1,%eax
  100201:	0f b7 c0             	movzwl %ax,%eax
  100204:	66 89 45 f6          	mov    %ax,-0xa(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100208:	0f b7 45 f6          	movzwl -0xa(%ebp),%eax
  10020c:	89 c2                	mov    %eax,%edx
  10020e:	ec                   	in     (%dx),%al
  10020f:	88 45 f8             	mov    %al,-0x8(%ebp)
	return data;
  100212:	0f b6 45 f8          	movzbl -0x8(%ebp),%eax
  100216:	0f b6 c0             	movzbl %al,%eax
  100219:	c1 e0 08             	shl    $0x8,%eax
  10021c:	89 45 ec             	mov    %eax,-0x14(%ebp)
	outb(addr_6845, 15);
  10021f:	0f b7 05 02 21 10 00 	movzwl 0x102102,%eax
  100226:	0f b7 c0             	movzwl %ax,%eax
  100229:	66 89 45 fa          	mov    %ax,-0x6(%ebp)
  10022d:	c6 45 f9 0f          	movb   $0xf,-0x7(%ebp)
			: "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
  100231:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
  100235:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
  100239:	ee                   	out    %al,(%dx)
	pos |= inb(addr_6845 + 1);
  10023a:	0f b7 05 02 21 10 00 	movzwl 0x102102,%eax
  100241:	83 c0 01             	add    $0x1,%eax
  100244:	0f b7 c0             	movzwl %ax,%eax
  100247:	66 89 45 fc          	mov    %ax,-0x4(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  10024b:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
  10024f:	89 c2                	mov    %eax,%edx
  100251:	ec                   	in     (%dx),%al
  100252:	88 45 ff             	mov    %al,-0x1(%ebp)
	return data;
  100255:	0f b6 45 ff          	movzbl -0x1(%ebp),%eax
  100259:	0f b6 c0             	movzbl %al,%eax
  10025c:	09 45 ec             	or     %eax,-0x14(%ebp)

	crt_buf = (uint16_t*) cp;
  10025f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  100262:	a3 fc 20 10 00       	mov    %eax,0x1020fc
	crt_pos = pos;
  100267:	8b 45 ec             	mov    -0x14(%ebp),%eax
  10026a:	66 a3 00 21 10 00    	mov    %ax,0x102100
}
  100270:	c9                   	leave  
  100271:	c3                   	ret    

00100272 <serial_init>:

static bool serial_exists = 0;

static void
serial_init(void) {
  100272:	55                   	push   %ebp
  100273:	89 e5                	mov    %esp,%ebp
  100275:	83 ec 30             	sub    $0x30,%esp
  100278:	66 c7 45 da fa 03    	movw   $0x3fa,-0x26(%ebp)
  10027e:	c6 45 d9 00          	movb   $0x0,-0x27(%ebp)
			: "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
  100282:	0f b6 45 d9          	movzbl -0x27(%ebp),%eax
  100286:	0f b7 55 da          	movzwl -0x26(%ebp),%edx
  10028a:	ee                   	out    %al,(%dx)
  10028b:	66 c7 45 de fb 03    	movw   $0x3fb,-0x22(%ebp)
  100291:	c6 45 dd 80          	movb   $0x80,-0x23(%ebp)
  100295:	0f b6 45 dd          	movzbl -0x23(%ebp),%eax
  100299:	0f b7 55 de          	movzwl -0x22(%ebp),%edx
  10029d:	ee                   	out    %al,(%dx)
  10029e:	66 c7 45 e2 f8 03    	movw   $0x3f8,-0x1e(%ebp)
  1002a4:	c6 45 e1 0c          	movb   $0xc,-0x1f(%ebp)
  1002a8:	0f b6 45 e1          	movzbl -0x1f(%ebp),%eax
  1002ac:	0f b7 55 e2          	movzwl -0x1e(%ebp),%edx
  1002b0:	ee                   	out    %al,(%dx)
  1002b1:	66 c7 45 e6 f9 03    	movw   $0x3f9,-0x1a(%ebp)
  1002b7:	c6 45 e5 00          	movb   $0x0,-0x1b(%ebp)
  1002bb:	0f b6 45 e5          	movzbl -0x1b(%ebp),%eax
  1002bf:	0f b7 55 e6          	movzwl -0x1a(%ebp),%edx
  1002c3:	ee                   	out    %al,(%dx)
  1002c4:	66 c7 45 ea fb 03    	movw   $0x3fb,-0x16(%ebp)
  1002ca:	c6 45 e9 03          	movb   $0x3,-0x17(%ebp)
  1002ce:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
  1002d2:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
  1002d6:	ee                   	out    %al,(%dx)
  1002d7:	66 c7 45 ee fc 03    	movw   $0x3fc,-0x12(%ebp)
  1002dd:	c6 45 ed 00          	movb   $0x0,-0x13(%ebp)
  1002e1:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
  1002e5:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
  1002e9:	ee                   	out    %al,(%dx)
  1002ea:	66 c7 45 f2 f9 03    	movw   $0x3f9,-0xe(%ebp)
  1002f0:	c6 45 f1 01          	movb   $0x1,-0xf(%ebp)
  1002f4:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
  1002f8:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
  1002fc:	ee                   	out    %al,(%dx)
  1002fd:	66 c7 45 f4 fd 03    	movw   $0x3fd,-0xc(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100303:	0f b7 45 f4          	movzwl -0xc(%ebp),%eax
  100307:	89 c2                	mov    %eax,%edx
  100309:	ec                   	in     (%dx),%al
  10030a:	88 45 f7             	mov    %al,-0x9(%ebp)
	return data;
  10030d:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
	// Enable rcv interrupts
	outb(COM1 + COM_IER, COM_IER_RDI);

	// Clear any preexisting overrun indications and interrupts
	// Serial port doesn't exist if COM_LSR returns 0xFF
	serial_exists = (inb(COM1 + COM_LSR) != 0xFF);
  100311:	3c ff                	cmp    $0xff,%al
  100313:	0f 95 c0             	setne  %al
  100316:	0f b6 c0             	movzbl %al,%eax
  100319:	a3 04 21 10 00       	mov    %eax,0x102104
  10031e:	66 c7 45 f8 fa 03    	movw   $0x3fa,-0x8(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100324:	0f b7 45 f8          	movzwl -0x8(%ebp),%eax
  100328:	89 c2                	mov    %eax,%edx
  10032a:	ec                   	in     (%dx),%al
  10032b:	88 45 fb             	mov    %al,-0x5(%ebp)
	return data;
  10032e:	66 c7 45 fc f8 03    	movw   $0x3f8,-0x4(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  100334:	0f b7 45 fc          	movzwl -0x4(%ebp),%eax
  100338:	89 c2                	mov    %eax,%edx
  10033a:	ec                   	in     (%dx),%al
  10033b:	88 45 ff             	mov    %al,-0x1(%ebp)

	(void) inb(COM1+COM_IIR);
	(void) inb(COM1+COM_RX);
}
  10033e:	c9                   	leave  
  10033f:	c3                   	ret    

00100340 <lpt_putc>:

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
  100340:	55                   	push   %ebp
  100341:	89 e5                	mov    %esp,%ebp
  100343:	83 ec 20             	sub    $0x20,%esp
	int i;
	for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
  100346:	c7 45 ec 00 00 00 00 	movl   $0x0,-0x14(%ebp)
  10034d:	eb 09                	jmp    100358 <lpt_putc+0x18>
		delay();
  10034f:	e8 f0 fd ff ff       	call   100144 <delay>

/* lpt_putc - copy console output to parallel port */
static void
lpt_putc(int c) {
	int i;
	for (i = 0; !(inb(LPTPORT + 1) & 0x80) && i < 12800; i ++) {
  100354:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
  100358:	66 c7 45 f2 79 03    	movw   $0x379,-0xe(%ebp)
  10035e:	0f b7 45 f2          	movzwl -0xe(%ebp),%eax
  100362:	89 c2                	mov    %eax,%edx
  100364:	ec                   	in     (%dx),%al
  100365:	88 45 f4             	mov    %al,-0xc(%ebp)
	return data;
  100368:	0f b6 45 f4          	movzbl -0xc(%ebp),%eax
  10036c:	84 c0                	test   %al,%al
  10036e:	78 09                	js     100379 <lpt_putc+0x39>
  100370:	81 7d ec ff 31 00 00 	cmpl   $0x31ff,-0x14(%ebp)
  100377:	7e d6                	jle    10034f <lpt_putc+0xf>
		delay();
	}
	outb(LPTPORT + 0, c);
  100379:	8b 45 08             	mov    0x8(%ebp),%eax
  10037c:	0f b6 c0             	movzbl %al,%eax
  10037f:	66 c7 45 f6 78 03    	movw   $0x378,-0xa(%ebp)
  100385:	88 45 f5             	mov    %al,-0xb(%ebp)
			: "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
  100388:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
  10038c:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
  100390:	ee                   	out    %al,(%dx)
  100391:	66 c7 45 fa 7a 03    	movw   $0x37a,-0x6(%ebp)
  100397:	c6 45 f9 0d          	movb   $0xd,-0x7(%ebp)
  10039b:	0f b6 45 f9          	movzbl -0x7(%ebp),%eax
  10039f:	0f b7 55 fa          	movzwl -0x6(%ebp),%edx
  1003a3:	ee                   	out    %al,(%dx)
  1003a4:	66 c7 45 fe 7a 03    	movw   $0x37a,-0x2(%ebp)
  1003aa:	c6 45 fd 08          	movb   $0x8,-0x3(%ebp)
  1003ae:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
  1003b2:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
  1003b6:	ee                   	out    %al,(%dx)
	outb(LPTPORT + 2, 0x08 | 0x04 | 0x01);
	outb(LPTPORT + 2, 0x08);
}
  1003b7:	c9                   	leave  
  1003b8:	c3                   	ret    

001003b9 <cga_putc>:

/* cga_putc - print character to console */
static void
cga_putc(int c) {
  1003b9:	55                   	push   %ebp
  1003ba:	89 e5                	mov    %esp,%ebp
  1003bc:	53                   	push   %ebx
  1003bd:	83 ec 34             	sub    $0x34,%esp
	// set black on white
	if (!(c & ~0xFF)) {
  1003c0:	8b 45 08             	mov    0x8(%ebp),%eax
  1003c3:	b0 00                	mov    $0x0,%al
  1003c5:	85 c0                	test   %eax,%eax
  1003c7:	75 07                	jne    1003d0 <cga_putc+0x17>
		c |= 0x0700;
  1003c9:	81 4d 08 00 07 00 00 	orl    $0x700,0x8(%ebp)
	}

	switch (c & 0xff) {
  1003d0:	8b 45 08             	mov    0x8(%ebp),%eax
  1003d3:	25 ff 00 00 00       	and    $0xff,%eax
  1003d8:	83 f8 0a             	cmp    $0xa,%eax
  1003db:	74 4f                	je     10042c <cga_putc+0x73>
  1003dd:	83 f8 0d             	cmp    $0xd,%eax
  1003e0:	74 5a                	je     10043c <cga_putc+0x83>
  1003e2:	83 f8 08             	cmp    $0x8,%eax
  1003e5:	0f 85 8d 00 00 00    	jne    100478 <cga_putc+0xbf>
	case '\b':
		if (crt_pos > 0) {
  1003eb:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  1003f2:	66 85 c0             	test   %ax,%ax
  1003f5:	0f 84 a3 00 00 00    	je     10049e <cga_putc+0xe5>
			crt_pos --;
  1003fb:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  100402:	83 e8 01             	sub    $0x1,%eax
  100405:	66 a3 00 21 10 00    	mov    %ax,0x102100
			crt_buf[crt_pos] = (c & ~0xff) | ' ';
  10040b:	a1 fc 20 10 00       	mov    0x1020fc,%eax
  100410:	0f b7 15 00 21 10 00 	movzwl 0x102100,%edx
  100417:	0f b7 d2             	movzwl %dx,%edx
  10041a:	01 d2                	add    %edx,%edx
  10041c:	8d 14 10             	lea    (%eax,%edx,1),%edx
  10041f:	8b 45 08             	mov    0x8(%ebp),%eax
  100422:	b0 00                	mov    $0x0,%al
  100424:	83 c8 20             	or     $0x20,%eax
  100427:	66 89 02             	mov    %ax,(%edx)
		}
		break;
  10042a:	eb 73                	jmp    10049f <cga_putc+0xe6>
	case '\n':
		crt_pos += CRT_COLS;
  10042c:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  100433:	83 c0 50             	add    $0x50,%eax
  100436:	66 a3 00 21 10 00    	mov    %ax,0x102100
	case '\r':
		crt_pos -= (crt_pos % CRT_COLS);
  10043c:	0f b7 1d 00 21 10 00 	movzwl 0x102100,%ebx
  100443:	0f b7 0d 00 21 10 00 	movzwl 0x102100,%ecx
  10044a:	0f b7 c1             	movzwl %cx,%eax
  10044d:	69 c0 cd cc 00 00    	imul   $0xcccd,%eax,%eax
  100453:	c1 e8 10             	shr    $0x10,%eax
  100456:	89 c2                	mov    %eax,%edx
  100458:	66 c1 ea 06          	shr    $0x6,%dx
  10045c:	89 d0                	mov    %edx,%eax
  10045e:	c1 e0 02             	shl    $0x2,%eax
  100461:	01 d0                	add    %edx,%eax
  100463:	c1 e0 04             	shl    $0x4,%eax
  100466:	89 ca                	mov    %ecx,%edx
  100468:	66 29 c2             	sub    %ax,%dx
  10046b:	89 d8                	mov    %ebx,%eax
  10046d:	66 29 d0             	sub    %dx,%ax
  100470:	66 a3 00 21 10 00    	mov    %ax,0x102100
		break;
  100476:	eb 27                	jmp    10049f <cga_putc+0xe6>
	default:
		crt_buf[crt_pos ++] = c;     // write the character
  100478:	8b 15 fc 20 10 00    	mov    0x1020fc,%edx
  10047e:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  100485:	0f b7 c8             	movzwl %ax,%ecx
  100488:	01 c9                	add    %ecx,%ecx
  10048a:	8d 0c 0a             	lea    (%edx,%ecx,1),%ecx
  10048d:	8b 55 08             	mov    0x8(%ebp),%edx
  100490:	66 89 11             	mov    %dx,(%ecx)
  100493:	83 c0 01             	add    $0x1,%eax
  100496:	66 a3 00 21 10 00    	mov    %ax,0x102100
  10049c:	eb 01                	jmp    10049f <cga_putc+0xe6>
	case '\b':
		if (crt_pos > 0) {
			crt_pos --;
			crt_buf[crt_pos] = (c & ~0xff) | ' ';
		}
		break;
  10049e:	90                   	nop
		crt_buf[crt_pos ++] = c;     // write the character
		break;
	}

	// What is the purpose of this?
	if (crt_pos >= CRT_SIZE) {
  10049f:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  1004a6:	66 3d cf 07          	cmp    $0x7cf,%ax
  1004aa:	76 5b                	jbe    100507 <cga_putc+0x14e>
		int i;
		memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
  1004ac:	a1 fc 20 10 00       	mov    0x1020fc,%eax
  1004b1:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
  1004b7:	a1 fc 20 10 00       	mov    0x1020fc,%eax
  1004bc:	c7 44 24 08 00 0f 00 	movl   $0xf00,0x8(%esp)
  1004c3:	00 
  1004c4:	89 54 24 04          	mov    %edx,0x4(%esp)
  1004c8:	89 04 24             	mov    %eax,(%esp)
  1004cb:	e8 01 09 00 00       	call   100dd1 <memmove>
		for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
  1004d0:	c7 45 e4 80 07 00 00 	movl   $0x780,-0x1c(%ebp)
  1004d7:	eb 15                	jmp    1004ee <cga_putc+0x135>
			crt_buf[i] = 0x0700 | ' ';
  1004d9:	a1 fc 20 10 00       	mov    0x1020fc,%eax
  1004de:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  1004e1:	01 d2                	add    %edx,%edx
  1004e3:	01 d0                	add    %edx,%eax
  1004e5:	66 c7 00 20 07       	movw   $0x720,(%eax)

	// What is the purpose of this?
	if (crt_pos >= CRT_SIZE) {
		int i;
		memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
		for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i ++) {
  1004ea:	83 45 e4 01          	addl   $0x1,-0x1c(%ebp)
  1004ee:	81 7d e4 cf 07 00 00 	cmpl   $0x7cf,-0x1c(%ebp)
  1004f5:	7e e2                	jle    1004d9 <cga_putc+0x120>
			crt_buf[i] = 0x0700 | ' ';
		}
		crt_pos -= CRT_COLS;
  1004f7:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  1004fe:	83 e8 50             	sub    $0x50,%eax
  100501:	66 a3 00 21 10 00    	mov    %ax,0x102100
	}

	// move that little blinky thing
	outb(addr_6845, 14);
  100507:	0f b7 05 02 21 10 00 	movzwl 0x102102,%eax
  10050e:	0f b7 c0             	movzwl %ax,%eax
  100511:	66 89 45 ea          	mov    %ax,-0x16(%ebp)
  100515:	c6 45 e9 0e          	movb   $0xe,-0x17(%ebp)
  100519:	0f b6 45 e9          	movzbl -0x17(%ebp),%eax
  10051d:	0f b7 55 ea          	movzwl -0x16(%ebp),%edx
  100521:	ee                   	out    %al,(%dx)
	outb(addr_6845 + 1, crt_pos >> 8);
  100522:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  100529:	66 c1 e8 08          	shr    $0x8,%ax
  10052d:	0f b6 c0             	movzbl %al,%eax
  100530:	0f b7 15 02 21 10 00 	movzwl 0x102102,%edx
  100537:	83 c2 01             	add    $0x1,%edx
  10053a:	0f b7 d2             	movzwl %dx,%edx
  10053d:	66 89 55 ee          	mov    %dx,-0x12(%ebp)
  100541:	88 45 ed             	mov    %al,-0x13(%ebp)
  100544:	0f b6 45 ed          	movzbl -0x13(%ebp),%eax
  100548:	0f b7 55 ee          	movzwl -0x12(%ebp),%edx
  10054c:	ee                   	out    %al,(%dx)
	outb(addr_6845, 15);
  10054d:	0f b7 05 02 21 10 00 	movzwl 0x102102,%eax
  100554:	0f b7 c0             	movzwl %ax,%eax
  100557:	66 89 45 f2          	mov    %ax,-0xe(%ebp)
  10055b:	c6 45 f1 0f          	movb   $0xf,-0xf(%ebp)
  10055f:	0f b6 45 f1          	movzbl -0xf(%ebp),%eax
  100563:	0f b7 55 f2          	movzwl -0xe(%ebp),%edx
  100567:	ee                   	out    %al,(%dx)
	outb(addr_6845 + 1, crt_pos);
  100568:	0f b7 05 00 21 10 00 	movzwl 0x102100,%eax
  10056f:	0f b6 c0             	movzbl %al,%eax
  100572:	0f b7 15 02 21 10 00 	movzwl 0x102102,%edx
  100579:	83 c2 01             	add    $0x1,%edx
  10057c:	0f b7 d2             	movzwl %dx,%edx
  10057f:	66 89 55 f6          	mov    %dx,-0xa(%ebp)
  100583:	88 45 f5             	mov    %al,-0xb(%ebp)
  100586:	0f b6 45 f5          	movzbl -0xb(%ebp),%eax
  10058a:	0f b7 55 f6          	movzwl -0xa(%ebp),%edx
  10058e:	ee                   	out    %al,(%dx)
}
  10058f:	83 c4 34             	add    $0x34,%esp
  100592:	5b                   	pop    %ebx
  100593:	5d                   	pop    %ebp
  100594:	c3                   	ret    

00100595 <serial_putc>:

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
  100595:	55                   	push   %ebp
  100596:	89 e5                	mov    %esp,%ebp
  100598:	83 ec 10             	sub    $0x10,%esp
    int i;
	for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
  10059b:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  1005a2:	eb 09                	jmp    1005ad <serial_putc+0x18>
		delay();
  1005a4:	e8 9b fb ff ff       	call   100144 <delay>

/* serial_putc - print character to serial port */
static void
serial_putc(int c) {
    int i;
	for (i = 0; !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800; i ++) {
  1005a9:	83 45 f4 01          	addl   $0x1,-0xc(%ebp)
  1005ad:	66 c7 45 fa fd 03    	movw   $0x3fd,-0x6(%ebp)
static inline void outw(uint16_t port, uint16_t data) __attribute__((always_inline));

static inline uint8_t
inb(uint16_t port) {
	uint8_t data;
	asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
  1005b3:	0f b7 45 fa          	movzwl -0x6(%ebp),%eax
  1005b7:	89 c2                	mov    %eax,%edx
  1005b9:	ec                   	in     (%dx),%al
  1005ba:	88 45 fc             	mov    %al,-0x4(%ebp)
	return data;
  1005bd:	0f b6 45 fc          	movzbl -0x4(%ebp),%eax
  1005c1:	0f b6 c0             	movzbl %al,%eax
  1005c4:	83 e0 20             	and    $0x20,%eax
  1005c7:	85 c0                	test   %eax,%eax
  1005c9:	75 09                	jne    1005d4 <serial_putc+0x3f>
  1005cb:	81 7d f4 ff 31 00 00 	cmpl   $0x31ff,-0xc(%ebp)
  1005d2:	7e d0                	jle    1005a4 <serial_putc+0xf>
		delay();
	}
	outb(COM1 + COM_TX, c);
  1005d4:	8b 45 08             	mov    0x8(%ebp),%eax
  1005d7:	0f b6 c0             	movzbl %al,%eax
  1005da:	66 c7 45 fe f8 03    	movw   $0x3f8,-0x2(%ebp)
  1005e0:	88 45 fd             	mov    %al,-0x3(%ebp)
			: "memory", "cc");
}

static inline void
outb(uint16_t port, uint8_t data) {
	asm volatile ("outb %0, %1" :: "a" (data), "d" (port));
  1005e3:	0f b6 45 fd          	movzbl -0x3(%ebp),%eax
  1005e7:	0f b7 55 fe          	movzwl -0x2(%ebp),%edx
  1005eb:	ee                   	out    %al,(%dx)
}
  1005ec:	c9                   	leave  
  1005ed:	c3                   	ret    

001005ee <cons_init>:

/* cons_init - initializes the console devices */
void
cons_init(void) {
  1005ee:	55                   	push   %ebp
  1005ef:	89 e5                	mov    %esp,%ebp
  1005f1:	83 ec 18             	sub    $0x18,%esp
	cga_init();
  1005f4:	e8 93 fb ff ff       	call   10018c <cga_init>
	serial_init();
  1005f9:	e8 74 fc ff ff       	call   100272 <serial_init>
	if (!serial_exists) {
  1005fe:	a1 04 21 10 00       	mov    0x102104,%eax
  100603:	85 c0                	test   %eax,%eax
  100605:	75 0c                	jne    100613 <cons_init+0x25>
		cprintf("serial port does not exist!!\n");
  100607:	c7 04 24 e0 0e 10 00 	movl   $0x100ee0,(%esp)
  10060e:	e8 a1 fa ff ff       	call   1000b4 <cprintf>
	}
}
  100613:	c9                   	leave  
  100614:	c3                   	ret    

00100615 <cons_putc>:

/* cons_putc - print a single character @c to console devices */
void
cons_putc(int c) {
  100615:	55                   	push   %ebp
  100616:	89 e5                	mov    %esp,%ebp
  100618:	83 ec 18             	sub    $0x18,%esp
	lpt_putc(c);
  10061b:	8b 45 08             	mov    0x8(%ebp),%eax
  10061e:	89 04 24             	mov    %eax,(%esp)
  100621:	e8 1a fd ff ff       	call   100340 <lpt_putc>
	cga_putc(c);
  100626:	8b 45 08             	mov    0x8(%ebp),%eax
  100629:	89 04 24             	mov    %eax,(%esp)
  10062c:	e8 88 fd ff ff       	call   1003b9 <cga_putc>
	serial_putc(c);
  100631:	8b 45 08             	mov    0x8(%ebp),%eax
  100634:	89 04 24             	mov    %eax,(%esp)
  100637:	e8 59 ff ff ff       	call   100595 <serial_putc>
}
  10063c:	c9                   	leave  
  10063d:	c3                   	ret    
  10063e:	90                   	nop
  10063f:	90                   	nop

00100640 <printnum>:
 * @width: 		maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:		character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
		unsigned long long num, unsigned base, int width, int padc) {
  100640:	55                   	push   %ebp
  100641:	89 e5                	mov    %esp,%ebp
  100643:	83 ec 58             	sub    $0x58,%esp
  100646:	8b 45 10             	mov    0x10(%ebp),%eax
  100649:	89 45 d0             	mov    %eax,-0x30(%ebp)
  10064c:	8b 45 14             	mov    0x14(%ebp),%eax
  10064f:	89 45 d4             	mov    %eax,-0x2c(%ebp)
	unsigned long long result = num;
  100652:	8b 45 d0             	mov    -0x30(%ebp),%eax
  100655:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  100658:	89 45 d8             	mov    %eax,-0x28(%ebp)
  10065b:	89 55 dc             	mov    %edx,-0x24(%ebp)
	unsigned mod = do_div(result, base);
  10065e:	8b 45 18             	mov    0x18(%ebp),%eax
  100661:	89 45 f4             	mov    %eax,-0xc(%ebp)
  100664:	8b 45 d8             	mov    -0x28(%ebp),%eax
  100667:	8b 55 dc             	mov    -0x24(%ebp),%edx
  10066a:	89 45 e8             	mov    %eax,-0x18(%ebp)
  10066d:	89 55 ec             	mov    %edx,-0x14(%ebp)
  100670:	8b 45 ec             	mov    -0x14(%ebp),%eax
  100673:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  100676:	83 7d ec 00          	cmpl   $0x0,-0x14(%ebp)
  10067a:	74 1c                	je     100698 <printnum+0x58>
  10067c:	8b 45 ec             	mov    -0x14(%ebp),%eax
  10067f:	ba 00 00 00 00       	mov    $0x0,%edx
  100684:	f7 75 f4             	divl   -0xc(%ebp)
  100687:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  10068a:	8b 45 ec             	mov    -0x14(%ebp),%eax
  10068d:	ba 00 00 00 00       	mov    $0x0,%edx
  100692:	f7 75 f4             	divl   -0xc(%ebp)
  100695:	89 45 ec             	mov    %eax,-0x14(%ebp)
  100698:	8b 45 e8             	mov    -0x18(%ebp),%eax
  10069b:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  10069e:	f7 75 f4             	divl   -0xc(%ebp)
  1006a1:	89 45 e8             	mov    %eax,-0x18(%ebp)
  1006a4:	89 55 f0             	mov    %edx,-0x10(%ebp)
  1006a7:	8b 45 e8             	mov    -0x18(%ebp),%eax
  1006aa:	8b 55 ec             	mov    -0x14(%ebp),%edx
  1006ad:	89 45 d8             	mov    %eax,-0x28(%ebp)
  1006b0:	89 55 dc             	mov    %edx,-0x24(%ebp)
  1006b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
  1006b6:	89 45 e0             	mov    %eax,-0x20(%ebp)

	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  1006b9:	8b 45 18             	mov    0x18(%ebp),%eax
  1006bc:	ba 00 00 00 00       	mov    $0x0,%edx
  1006c1:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
  1006c4:	77 56                	ja     10071c <printnum+0xdc>
  1006c6:	3b 55 d4             	cmp    -0x2c(%ebp),%edx
  1006c9:	72 05                	jb     1006d0 <printnum+0x90>
  1006cb:	3b 45 d0             	cmp    -0x30(%ebp),%eax
  1006ce:	77 4c                	ja     10071c <printnum+0xdc>
		printnum(putch, putdat, result, base, width - 1, padc);
  1006d0:	8b 45 1c             	mov    0x1c(%ebp),%eax
  1006d3:	8d 50 ff             	lea    -0x1(%eax),%edx
  1006d6:	8b 45 20             	mov    0x20(%ebp),%eax
  1006d9:	89 44 24 18          	mov    %eax,0x18(%esp)
  1006dd:	89 54 24 14          	mov    %edx,0x14(%esp)
  1006e1:	8b 45 18             	mov    0x18(%ebp),%eax
  1006e4:	89 44 24 10          	mov    %eax,0x10(%esp)
  1006e8:	8b 45 d8             	mov    -0x28(%ebp),%eax
  1006eb:	8b 55 dc             	mov    -0x24(%ebp),%edx
  1006ee:	89 44 24 08          	mov    %eax,0x8(%esp)
  1006f2:	89 54 24 0c          	mov    %edx,0xc(%esp)
  1006f6:	8b 45 0c             	mov    0xc(%ebp),%eax
  1006f9:	89 44 24 04          	mov    %eax,0x4(%esp)
  1006fd:	8b 45 08             	mov    0x8(%ebp),%eax
  100700:	89 04 24             	mov    %eax,(%esp)
  100703:	e8 38 ff ff ff       	call   100640 <printnum>
  100708:	eb 1c                	jmp    100726 <printnum+0xe6>
	} else {
		// print any needed pad characters before first digit
		while (-- width > 0)
			putch(padc, putdat);
  10070a:	8b 45 0c             	mov    0xc(%ebp),%eax
  10070d:	89 44 24 04          	mov    %eax,0x4(%esp)
  100711:	8b 45 20             	mov    0x20(%ebp),%eax
  100714:	89 04 24             	mov    %eax,(%esp)
  100717:	8b 45 08             	mov    0x8(%ebp),%eax
  10071a:	ff d0                	call   *%eax
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
		printnum(putch, putdat, result, base, width - 1, padc);
	} else {
		// print any needed pad characters before first digit
		while (-- width > 0)
  10071c:	83 6d 1c 01          	subl   $0x1,0x1c(%ebp)
  100720:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
  100724:	7f e4                	jg     10070a <printnum+0xca>
			putch(padc, putdat);
	}
	// then print this (the least significant) digit
	putch("0123456789abcdef"[mod], putdat);
  100726:	8b 45 e0             	mov    -0x20(%ebp),%eax
  100729:	0f b6 80 80 0f 10 00 	movzbl 0x100f80(%eax),%eax
  100730:	0f be c0             	movsbl %al,%eax
  100733:	8b 55 0c             	mov    0xc(%ebp),%edx
  100736:	89 54 24 04          	mov    %edx,0x4(%esp)
  10073a:	89 04 24             	mov    %eax,(%esp)
  10073d:	8b 45 08             	mov    0x8(%ebp),%eax
  100740:	ff d0                	call   *%eax
}
  100742:	c9                   	leave  
  100743:	c3                   	ret    

00100744 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:			a varargs list pointer
 * @lflag:		determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
  100744:	55                   	push   %ebp
  100745:	89 e5                	mov    %esp,%ebp
	if (lflag >= 2) {
  100747:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
  10074b:	7e 1c                	jle    100769 <getuint+0x25>
		return va_arg(*ap, unsigned long long);
  10074d:	8b 45 08             	mov    0x8(%ebp),%eax
  100750:	8b 00                	mov    (%eax),%eax
  100752:	8d 50 08             	lea    0x8(%eax),%edx
  100755:	8b 45 08             	mov    0x8(%ebp),%eax
  100758:	89 10                	mov    %edx,(%eax)
  10075a:	8b 45 08             	mov    0x8(%ebp),%eax
  10075d:	8b 00                	mov    (%eax),%eax
  10075f:	83 e8 08             	sub    $0x8,%eax
  100762:	8b 50 04             	mov    0x4(%eax),%edx
  100765:	8b 00                	mov    (%eax),%eax
  100767:	eb 40                	jmp    1007a9 <getuint+0x65>
	}
	else if (lflag) {
  100769:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  10076d:	74 1e                	je     10078d <getuint+0x49>
		return va_arg(*ap, unsigned long);
  10076f:	8b 45 08             	mov    0x8(%ebp),%eax
  100772:	8b 00                	mov    (%eax),%eax
  100774:	8d 50 04             	lea    0x4(%eax),%edx
  100777:	8b 45 08             	mov    0x8(%ebp),%eax
  10077a:	89 10                	mov    %edx,(%eax)
  10077c:	8b 45 08             	mov    0x8(%ebp),%eax
  10077f:	8b 00                	mov    (%eax),%eax
  100781:	83 e8 04             	sub    $0x4,%eax
  100784:	8b 00                	mov    (%eax),%eax
  100786:	ba 00 00 00 00       	mov    $0x0,%edx
  10078b:	eb 1c                	jmp    1007a9 <getuint+0x65>
	}
	else {
		return va_arg(*ap, unsigned int);
  10078d:	8b 45 08             	mov    0x8(%ebp),%eax
  100790:	8b 00                	mov    (%eax),%eax
  100792:	8d 50 04             	lea    0x4(%eax),%edx
  100795:	8b 45 08             	mov    0x8(%ebp),%eax
  100798:	89 10                	mov    %edx,(%eax)
  10079a:	8b 45 08             	mov    0x8(%ebp),%eax
  10079d:	8b 00                	mov    (%eax),%eax
  10079f:	83 e8 04             	sub    $0x4,%eax
  1007a2:	8b 00                	mov    (%eax),%eax
  1007a4:	ba 00 00 00 00       	mov    $0x0,%edx
	}
}
  1007a9:	5d                   	pop    %ebp
  1007aa:	c3                   	ret    

001007ab <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:			a varargs list pointer
 * @lflag:		determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
  1007ab:	55                   	push   %ebp
  1007ac:	89 e5                	mov    %esp,%ebp
	if (lflag >= 2) {
  1007ae:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
  1007b2:	7e 1c                	jle    1007d0 <getint+0x25>
		return va_arg(*ap, long long);
  1007b4:	8b 45 08             	mov    0x8(%ebp),%eax
  1007b7:	8b 00                	mov    (%eax),%eax
  1007b9:	8d 50 08             	lea    0x8(%eax),%edx
  1007bc:	8b 45 08             	mov    0x8(%ebp),%eax
  1007bf:	89 10                	mov    %edx,(%eax)
  1007c1:	8b 45 08             	mov    0x8(%ebp),%eax
  1007c4:	8b 00                	mov    (%eax),%eax
  1007c6:	83 e8 08             	sub    $0x8,%eax
  1007c9:	8b 50 04             	mov    0x4(%eax),%edx
  1007cc:	8b 00                	mov    (%eax),%eax
  1007ce:	eb 40                	jmp    100810 <getint+0x65>
	}
	else if (lflag) {
  1007d0:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  1007d4:	74 1e                	je     1007f4 <getint+0x49>
		return va_arg(*ap, long);
  1007d6:	8b 45 08             	mov    0x8(%ebp),%eax
  1007d9:	8b 00                	mov    (%eax),%eax
  1007db:	8d 50 04             	lea    0x4(%eax),%edx
  1007de:	8b 45 08             	mov    0x8(%ebp),%eax
  1007e1:	89 10                	mov    %edx,(%eax)
  1007e3:	8b 45 08             	mov    0x8(%ebp),%eax
  1007e6:	8b 00                	mov    (%eax),%eax
  1007e8:	83 e8 04             	sub    $0x4,%eax
  1007eb:	8b 00                	mov    (%eax),%eax
  1007ed:	89 c2                	mov    %eax,%edx
  1007ef:	c1 fa 1f             	sar    $0x1f,%edx
  1007f2:	eb 1c                	jmp    100810 <getint+0x65>
	}
	else {
		return va_arg(*ap, int);
  1007f4:	8b 45 08             	mov    0x8(%ebp),%eax
  1007f7:	8b 00                	mov    (%eax),%eax
  1007f9:	8d 50 04             	lea    0x4(%eax),%edx
  1007fc:	8b 45 08             	mov    0x8(%ebp),%eax
  1007ff:	89 10                	mov    %edx,(%eax)
  100801:	8b 45 08             	mov    0x8(%ebp),%eax
  100804:	8b 00                	mov    (%eax),%eax
  100806:	83 e8 04             	sub    $0x4,%eax
  100809:	8b 00                	mov    (%eax),%eax
  10080b:	89 c2                	mov    %eax,%edx
  10080d:	c1 fa 1f             	sar    $0x1f,%edx
	}
}
  100810:	5d                   	pop    %ebp
  100811:	c3                   	ret    

00100812 <printfmt>:
 * @putch:		specified putch function, print a single character
 * @putdat:		used by @putch function
 * @fmt:		the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
  100812:	55                   	push   %ebp
  100813:	89 e5                	mov    %esp,%ebp
  100815:	83 ec 28             	sub    $0x28,%esp
	va_list ap;

	va_start(ap, fmt);
  100818:	8d 45 10             	lea    0x10(%ebp),%eax
  10081b:	83 c0 04             	add    $0x4,%eax
  10081e:	89 45 f4             	mov    %eax,-0xc(%ebp)
	vprintfmt(putch, putdat, fmt, ap);
  100821:	8b 45 10             	mov    0x10(%ebp),%eax
  100824:	8b 55 f4             	mov    -0xc(%ebp),%edx
  100827:	89 54 24 0c          	mov    %edx,0xc(%esp)
  10082b:	89 44 24 08          	mov    %eax,0x8(%esp)
  10082f:	8b 45 0c             	mov    0xc(%ebp),%eax
  100832:	89 44 24 04          	mov    %eax,0x4(%esp)
  100836:	8b 45 08             	mov    0x8(%ebp),%eax
  100839:	89 04 24             	mov    %eax,(%esp)
  10083c:	e8 02 00 00 00       	call   100843 <vprintfmt>
	va_end(ap);
}
  100841:	c9                   	leave  
  100842:	c3                   	ret    

00100843 <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
  100843:	55                   	push   %ebp
  100844:	89 e5                	mov    %esp,%ebp
  100846:	56                   	push   %esi
  100847:	53                   	push   %ebx
  100848:	83 ec 40             	sub    $0x40,%esp
	register int ch, err;
	unsigned long long num;
	int base, width, precision, lflag, altflag;

	while (1) {
		while ((ch = *(unsigned char *)fmt ++) != '%') {
  10084b:	eb 17                	jmp    100864 <vprintfmt+0x21>
			if (ch == '\0') {
  10084d:	85 db                	test   %ebx,%ebx
  10084f:	0f 84 06 04 00 00    	je     100c5b <vprintfmt+0x418>
				return;
			}
			putch(ch, putdat);
  100855:	8b 45 0c             	mov    0xc(%ebp),%eax
  100858:	89 44 24 04          	mov    %eax,0x4(%esp)
  10085c:	89 1c 24             	mov    %ebx,(%esp)
  10085f:	8b 45 08             	mov    0x8(%ebp),%eax
  100862:	ff d0                	call   *%eax
	register int ch, err;
	unsigned long long num;
	int base, width, precision, lflag, altflag;

	while (1) {
		while ((ch = *(unsigned char *)fmt ++) != '%') {
  100864:	8b 45 10             	mov    0x10(%ebp),%eax
  100867:	0f b6 00             	movzbl (%eax),%eax
  10086a:	0f b6 d8             	movzbl %al,%ebx
  10086d:	83 fb 25             	cmp    $0x25,%ebx
  100870:	0f 95 c0             	setne  %al
  100873:	83 45 10 01          	addl   $0x1,0x10(%ebp)
  100877:	84 c0                	test   %al,%al
  100879:	75 d2                	jne    10084d <vprintfmt+0xa>
			}
			putch(ch, putdat);
		}

		// Process a %-escape sequence
		char padc = ' ';
  10087b:	c6 45 f7 20          	movb   $0x20,-0x9(%ebp)
		width = precision = -1;
  10087f:	c7 45 e8 ff ff ff ff 	movl   $0xffffffff,-0x18(%ebp)
  100886:	8b 45 e8             	mov    -0x18(%ebp),%eax
  100889:	89 45 e4             	mov    %eax,-0x1c(%ebp)
		lflag = altflag = 0;
  10088c:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  100893:	8b 45 f0             	mov    -0x10(%ebp),%eax
  100896:	89 45 ec             	mov    %eax,-0x14(%ebp)
  100899:	eb 04                	jmp    10089f <vprintfmt+0x5c>
			goto process_precision;

		case '.':
			if (width < 0)
				width = 0;
			goto reswitch;
  10089b:	90                   	nop
  10089c:	eb 01                	jmp    10089f <vprintfmt+0x5c>
			goto reswitch;

		process_precision:
			if (width < 0)
				width = precision, precision = -1;
			goto reswitch;
  10089e:	90                   	nop
		char padc = ' ';
		width = precision = -1;
		lflag = altflag = 0;

	reswitch:
		switch (ch = *(unsigned char *)fmt ++) {
  10089f:	8b 45 10             	mov    0x10(%ebp),%eax
  1008a2:	0f b6 00             	movzbl (%eax),%eax
  1008a5:	0f b6 d8             	movzbl %al,%ebx
  1008a8:	89 d8                	mov    %ebx,%eax
  1008aa:	83 45 10 01          	addl   $0x1,0x10(%ebp)
  1008ae:	83 e8 23             	sub    $0x23,%eax
  1008b1:	83 f8 55             	cmp    $0x55,%eax
  1008b4:	0f 87 71 03 00 00    	ja     100c2b <vprintfmt+0x3e8>
  1008ba:	8b 04 85 a4 0f 10 00 	mov    0x100fa4(,%eax,4),%eax
  1008c1:	ff e0                	jmp    *%eax

		// flag to pad on the right
		case '-':
			padc = '-';
  1008c3:	c6 45 f7 2d          	movb   $0x2d,-0x9(%ebp)
			goto reswitch;
  1008c7:	eb d6                	jmp    10089f <vprintfmt+0x5c>

		// flag to pad with 0's instead of spaces
		case '0':
			padc = '0';
  1008c9:	c6 45 f7 30          	movb   $0x30,-0x9(%ebp)
			goto reswitch;
  1008cd:	eb d0                	jmp    10089f <vprintfmt+0x5c>

		// width field
		case '1' ... '9':
			for (precision = 0; ; ++ fmt) {
  1008cf:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
				precision = precision * 10 + ch - '0';
  1008d6:	8b 55 e8             	mov    -0x18(%ebp),%edx
  1008d9:	89 d0                	mov    %edx,%eax
  1008db:	c1 e0 02             	shl    $0x2,%eax
  1008de:	01 d0                	add    %edx,%eax
  1008e0:	01 c0                	add    %eax,%eax
  1008e2:	01 d8                	add    %ebx,%eax
  1008e4:	83 e8 30             	sub    $0x30,%eax
  1008e7:	89 45 e8             	mov    %eax,-0x18(%ebp)
				ch = *fmt;
  1008ea:	8b 45 10             	mov    0x10(%ebp),%eax
  1008ed:	0f b6 00             	movzbl (%eax),%eax
  1008f0:	0f be d8             	movsbl %al,%ebx
				if (ch < '0' || ch > '9') {
  1008f3:	83 fb 2f             	cmp    $0x2f,%ebx
  1008f6:	7e 43                	jle    10093b <vprintfmt+0xf8>
  1008f8:	83 fb 39             	cmp    $0x39,%ebx
  1008fb:	7f 41                	jg     10093e <vprintfmt+0xfb>
			padc = '0';
			goto reswitch;

		// width field
		case '1' ... '9':
			for (precision = 0; ; ++ fmt) {
  1008fd:	83 45 10 01          	addl   $0x1,0x10(%ebp)
				precision = precision * 10 + ch - '0';
				ch = *fmt;
				if (ch < '0' || ch > '9') {
					break;
				}
			}
  100901:	eb d3                	jmp    1008d6 <vprintfmt+0x93>
			goto process_precision;

		case '*':
			precision = va_arg(ap, int);
  100903:	8b 45 14             	mov    0x14(%ebp),%eax
  100906:	83 c0 04             	add    $0x4,%eax
  100909:	89 45 14             	mov    %eax,0x14(%ebp)
  10090c:	8b 45 14             	mov    0x14(%ebp),%eax
  10090f:	83 e8 04             	sub    $0x4,%eax
  100912:	8b 00                	mov    (%eax),%eax
  100914:	89 45 e8             	mov    %eax,-0x18(%ebp)
			goto process_precision;
  100917:	eb 26                	jmp    10093f <vprintfmt+0xfc>

		case '.':
			if (width < 0)
  100919:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  10091d:	0f 89 78 ff ff ff    	jns    10089b <vprintfmt+0x58>
				width = 0;
  100923:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
			goto reswitch;
  10092a:	e9 70 ff ff ff       	jmp    10089f <vprintfmt+0x5c>

		case '#':
			altflag = 1;
  10092f:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)
			goto reswitch;
  100936:	e9 64 ff ff ff       	jmp    10089f <vprintfmt+0x5c>
				ch = *fmt;
				if (ch < '0' || ch > '9') {
					break;
				}
			}
			goto process_precision;
  10093b:	90                   	nop
  10093c:	eb 01                	jmp    10093f <vprintfmt+0xfc>
  10093e:	90                   	nop
		case '#':
			altflag = 1;
			goto reswitch;

		process_precision:
			if (width < 0)
  10093f:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  100943:	0f 89 55 ff ff ff    	jns    10089e <vprintfmt+0x5b>
				width = precision, precision = -1;
  100949:	8b 45 e8             	mov    -0x18(%ebp),%eax
  10094c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  10094f:	c7 45 e8 ff ff ff ff 	movl   $0xffffffff,-0x18(%ebp)
			goto reswitch;
  100956:	e9 44 ff ff ff       	jmp    10089f <vprintfmt+0x5c>

		// long flag (doubled for long long)
		case 'l':
			lflag ++;
  10095b:	83 45 ec 01          	addl   $0x1,-0x14(%ebp)
			goto reswitch;
  10095f:	e9 3b ff ff ff       	jmp    10089f <vprintfmt+0x5c>

		// character
		case 'c':
			putch(va_arg(ap, int), putdat);
  100964:	8b 45 14             	mov    0x14(%ebp),%eax
  100967:	83 c0 04             	add    $0x4,%eax
  10096a:	89 45 14             	mov    %eax,0x14(%ebp)
  10096d:	8b 45 14             	mov    0x14(%ebp),%eax
  100970:	83 e8 04             	sub    $0x4,%eax
  100973:	8b 00                	mov    (%eax),%eax
  100975:	8b 55 0c             	mov    0xc(%ebp),%edx
  100978:	89 54 24 04          	mov    %edx,0x4(%esp)
  10097c:	89 04 24             	mov    %eax,(%esp)
  10097f:	8b 45 08             	mov    0x8(%ebp),%eax
  100982:	ff d0                	call   *%eax
			break;
  100984:	e9 cc 02 00 00       	jmp    100c55 <vprintfmt+0x412>

		// error message
		case 'e':
			err = va_arg(ap, int);
  100989:	8b 45 14             	mov    0x14(%ebp),%eax
  10098c:	83 c0 04             	add    $0x4,%eax
  10098f:	89 45 14             	mov    %eax,0x14(%ebp)
  100992:	8b 45 14             	mov    0x14(%ebp),%eax
  100995:	83 e8 04             	sub    $0x4,%eax
  100998:	8b 18                	mov    (%eax),%ebx
			if (err < 0) {
  10099a:	85 db                	test   %ebx,%ebx
  10099c:	79 02                	jns    1009a0 <vprintfmt+0x15d>
				err = -err;
  10099e:	f7 db                	neg    %ebx
			}
			if (err > MAXERROR || (p = error_string[err]) == NULL) {
  1009a0:	83 fb 06             	cmp    $0x6,%ebx
  1009a3:	7f 0d                	jg     1009b2 <vprintfmt+0x16f>
  1009a5:	89 d8                	mov    %ebx,%eax
  1009a7:	8b 34 85 64 0f 10 00 	mov    0x100f64(,%eax,4),%esi
  1009ae:	85 f6                	test   %esi,%esi
  1009b0:	75 24                	jne    1009d6 <vprintfmt+0x193>
				printfmt(putch, putdat, "error %d", err);
  1009b2:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  1009b6:	c7 44 24 08 91 0f 10 	movl   $0x100f91,0x8(%esp)
  1009bd:	00 
  1009be:	8b 45 0c             	mov    0xc(%ebp),%eax
  1009c1:	89 44 24 04          	mov    %eax,0x4(%esp)
  1009c5:	8b 45 08             	mov    0x8(%ebp),%eax
  1009c8:	89 04 24             	mov    %eax,(%esp)
  1009cb:	e8 42 fe ff ff       	call   100812 <printfmt>
		case 'e':
			err = va_arg(ap, int);
			if (err < 0) {
				err = -err;
			}
			if (err > MAXERROR || (p = error_string[err]) == NULL) {
  1009d0:	90                   	nop
				printfmt(putch, putdat, "error %d", err);
			}
			else {
				printfmt(putch, putdat, "%s", p);
			}
			break;
  1009d1:	e9 7f 02 00 00       	jmp    100c55 <vprintfmt+0x412>
			}
			if (err > MAXERROR || (p = error_string[err]) == NULL) {
				printfmt(putch, putdat, "error %d", err);
			}
			else {
				printfmt(putch, putdat, "%s", p);
  1009d6:	89 74 24 0c          	mov    %esi,0xc(%esp)
  1009da:	c7 44 24 08 9a 0f 10 	movl   $0x100f9a,0x8(%esp)
  1009e1:	00 
  1009e2:	8b 45 0c             	mov    0xc(%ebp),%eax
  1009e5:	89 44 24 04          	mov    %eax,0x4(%esp)
  1009e9:	8b 45 08             	mov    0x8(%ebp),%eax
  1009ec:	89 04 24             	mov    %eax,(%esp)
  1009ef:	e8 1e fe ff ff       	call   100812 <printfmt>
			}
			break;
  1009f4:	e9 5c 02 00 00       	jmp    100c55 <vprintfmt+0x412>

		// string
		case 's':
			if ((p = va_arg(ap, char *)) == NULL) {
  1009f9:	8b 45 14             	mov    0x14(%ebp),%eax
  1009fc:	83 c0 04             	add    $0x4,%eax
  1009ff:	89 45 14             	mov    %eax,0x14(%ebp)
  100a02:	8b 45 14             	mov    0x14(%ebp),%eax
  100a05:	83 e8 04             	sub    $0x4,%eax
  100a08:	8b 30                	mov    (%eax),%esi
  100a0a:	85 f6                	test   %esi,%esi
  100a0c:	75 05                	jne    100a13 <vprintfmt+0x1d0>
				p = "(null)";
  100a0e:	be 9d 0f 10 00       	mov    $0x100f9d,%esi
			}
			if (width > 0 && padc != '-') {
  100a13:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  100a17:	7e 7c                	jle    100a95 <vprintfmt+0x252>
  100a19:	80 7d f7 2d          	cmpb   $0x2d,-0x9(%ebp)
  100a1d:	74 79                	je     100a98 <vprintfmt+0x255>
				for (width -= strnlen(p, precision); width > 0; width --) {
  100a1f:	8b 5d e4             	mov    -0x1c(%ebp),%ebx
  100a22:	8b 45 e8             	mov    -0x18(%ebp),%eax
  100a25:	89 44 24 04          	mov    %eax,0x4(%esp)
  100a29:	89 34 24             	mov    %esi,(%esp)
  100a2c:	e8 2e 03 00 00       	call   100d5f <strnlen>
  100a31:	89 da                	mov    %ebx,%edx
  100a33:	29 c2                	sub    %eax,%edx
  100a35:	89 d0                	mov    %edx,%eax
  100a37:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  100a3a:	eb 17                	jmp    100a53 <vprintfmt+0x210>
					putch(padc, putdat);
  100a3c:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
  100a40:	8b 55 0c             	mov    0xc(%ebp),%edx
  100a43:	89 54 24 04          	mov    %edx,0x4(%esp)
  100a47:	89 04 24             	mov    %eax,(%esp)
  100a4a:	8b 45 08             	mov    0x8(%ebp),%eax
  100a4d:	ff d0                	call   *%eax
		case 's':
			if ((p = va_arg(ap, char *)) == NULL) {
				p = "(null)";
			}
			if (width > 0 && padc != '-') {
				for (width -= strnlen(p, precision); width > 0; width --) {
  100a4f:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
  100a53:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  100a57:	7f e3                	jg     100a3c <vprintfmt+0x1f9>
					putch(padc, putdat);
				}
			}
			for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
  100a59:	eb 3e                	jmp    100a99 <vprintfmt+0x256>
				if (altflag && (ch < ' ' || ch > '~')) {
  100a5b:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
  100a5f:	74 1f                	je     100a80 <vprintfmt+0x23d>
  100a61:	83 fb 1f             	cmp    $0x1f,%ebx
  100a64:	7e 05                	jle    100a6b <vprintfmt+0x228>
  100a66:	83 fb 7e             	cmp    $0x7e,%ebx
  100a69:	7e 15                	jle    100a80 <vprintfmt+0x23d>
					putch('?', putdat);
  100a6b:	8b 45 0c             	mov    0xc(%ebp),%eax
  100a6e:	89 44 24 04          	mov    %eax,0x4(%esp)
  100a72:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
  100a79:	8b 45 08             	mov    0x8(%ebp),%eax
  100a7c:	ff d0                	call   *%eax
				for (width -= strnlen(p, precision); width > 0; width --) {
					putch(padc, putdat);
				}
			}
			for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
				if (altflag && (ch < ' ' || ch > '~')) {
  100a7e:	eb 0f                	jmp    100a8f <vprintfmt+0x24c>
					putch('?', putdat);
				}
				else {
					putch(ch, putdat);
  100a80:	8b 45 0c             	mov    0xc(%ebp),%eax
  100a83:	89 44 24 04          	mov    %eax,0x4(%esp)
  100a87:	89 1c 24             	mov    %ebx,(%esp)
  100a8a:	8b 45 08             	mov    0x8(%ebp),%eax
  100a8d:	ff d0                	call   *%eax
			if (width > 0 && padc != '-') {
				for (width -= strnlen(p, precision); width > 0; width --) {
					putch(padc, putdat);
				}
			}
			for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
  100a8f:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
  100a93:	eb 04                	jmp    100a99 <vprintfmt+0x256>
  100a95:	90                   	nop
  100a96:	eb 01                	jmp    100a99 <vprintfmt+0x256>
  100a98:	90                   	nop
  100a99:	0f b6 06             	movzbl (%esi),%eax
  100a9c:	0f be d8             	movsbl %al,%ebx
  100a9f:	85 db                	test   %ebx,%ebx
  100aa1:	0f 95 c0             	setne  %al
  100aa4:	83 c6 01             	add    $0x1,%esi
  100aa7:	84 c0                	test   %al,%al
  100aa9:	74 29                	je     100ad4 <vprintfmt+0x291>
  100aab:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  100aaf:	78 aa                	js     100a5b <vprintfmt+0x218>
  100ab1:	83 6d e8 01          	subl   $0x1,-0x18(%ebp)
  100ab5:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  100ab9:	79 a0                	jns    100a5b <vprintfmt+0x218>
				}
				else {
					putch(ch, putdat);
				}
			}
			for (; width > 0; width --) {
  100abb:	eb 17                	jmp    100ad4 <vprintfmt+0x291>
				putch(' ', putdat);
  100abd:	8b 45 0c             	mov    0xc(%ebp),%eax
  100ac0:	89 44 24 04          	mov    %eax,0x4(%esp)
  100ac4:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
  100acb:	8b 45 08             	mov    0x8(%ebp),%eax
  100ace:	ff d0                	call   *%eax
				}
				else {
					putch(ch, putdat);
				}
			}
			for (; width > 0; width --) {
  100ad0:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
  100ad4:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  100ad8:	7f e3                	jg     100abd <vprintfmt+0x27a>
				putch(' ', putdat);
			}
			break;
  100ada:	e9 76 01 00 00       	jmp    100c55 <vprintfmt+0x412>

		// (signed) decimal
		case 'd':
			num = getint(&ap, lflag);
  100adf:	8b 45 ec             	mov    -0x14(%ebp),%eax
  100ae2:	89 44 24 04          	mov    %eax,0x4(%esp)
  100ae6:	8d 45 14             	lea    0x14(%ebp),%eax
  100ae9:	89 04 24             	mov    %eax,(%esp)
  100aec:	e8 ba fc ff ff       	call   1007ab <getint>
  100af1:	89 45 d8             	mov    %eax,-0x28(%ebp)
  100af4:	89 55 dc             	mov    %edx,-0x24(%ebp)
			if ((long long)num < 0) {
  100af7:	8b 45 d8             	mov    -0x28(%ebp),%eax
  100afa:	8b 55 dc             	mov    -0x24(%ebp),%edx
  100afd:	85 d2                	test   %edx,%edx
  100aff:	79 26                	jns    100b27 <vprintfmt+0x2e4>
				putch('-', putdat);
  100b01:	8b 45 0c             	mov    0xc(%ebp),%eax
  100b04:	89 44 24 04          	mov    %eax,0x4(%esp)
  100b08:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
  100b0f:	8b 45 08             	mov    0x8(%ebp),%eax
  100b12:	ff d0                	call   *%eax
				num = -(long long)num;
  100b14:	8b 45 d8             	mov    -0x28(%ebp),%eax
  100b17:	8b 55 dc             	mov    -0x24(%ebp),%edx
  100b1a:	f7 d8                	neg    %eax
  100b1c:	83 d2 00             	adc    $0x0,%edx
  100b1f:	f7 da                	neg    %edx
  100b21:	89 45 d8             	mov    %eax,-0x28(%ebp)
  100b24:	89 55 dc             	mov    %edx,-0x24(%ebp)
			}
			base = 10;
  100b27:	c7 45 e0 0a 00 00 00 	movl   $0xa,-0x20(%ebp)
			goto number;
  100b2e:	e9 af 00 00 00       	jmp    100be2 <vprintfmt+0x39f>

		// unsigned decimal
		case 'u':
			num = getuint(&ap, lflag);
  100b33:	8b 45 ec             	mov    -0x14(%ebp),%eax
  100b36:	89 44 24 04          	mov    %eax,0x4(%esp)
  100b3a:	8d 45 14             	lea    0x14(%ebp),%eax
  100b3d:	89 04 24             	mov    %eax,(%esp)
  100b40:	e8 ff fb ff ff       	call   100744 <getuint>
  100b45:	89 45 d8             	mov    %eax,-0x28(%ebp)
  100b48:	89 55 dc             	mov    %edx,-0x24(%ebp)
			base = 10;
  100b4b:	c7 45 e0 0a 00 00 00 	movl   $0xa,-0x20(%ebp)
			goto number;
  100b52:	e9 8b 00 00 00       	jmp    100be2 <vprintfmt+0x39f>

		// (unsigned) octal
		case 'o':
			num = getuint(&ap, lflag);
  100b57:	8b 45 ec             	mov    -0x14(%ebp),%eax
  100b5a:	89 44 24 04          	mov    %eax,0x4(%esp)
  100b5e:	8d 45 14             	lea    0x14(%ebp),%eax
  100b61:	89 04 24             	mov    %eax,(%esp)
  100b64:	e8 db fb ff ff       	call   100744 <getuint>
  100b69:	89 45 d8             	mov    %eax,-0x28(%ebp)
  100b6c:	89 55 dc             	mov    %edx,-0x24(%ebp)
			base = 8;
  100b6f:	c7 45 e0 08 00 00 00 	movl   $0x8,-0x20(%ebp)
			goto number;
  100b76:	eb 6a                	jmp    100be2 <vprintfmt+0x39f>

		// pointer
		case 'p':
			putch('0', putdat);
  100b78:	8b 45 0c             	mov    0xc(%ebp),%eax
  100b7b:	89 44 24 04          	mov    %eax,0x4(%esp)
  100b7f:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
  100b86:	8b 45 08             	mov    0x8(%ebp),%eax
  100b89:	ff d0                	call   *%eax
			putch('x', putdat);
  100b8b:	8b 45 0c             	mov    0xc(%ebp),%eax
  100b8e:	89 44 24 04          	mov    %eax,0x4(%esp)
  100b92:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
  100b99:	8b 45 08             	mov    0x8(%ebp),%eax
  100b9c:	ff d0                	call   *%eax
			num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
  100b9e:	8b 45 14             	mov    0x14(%ebp),%eax
  100ba1:	83 c0 04             	add    $0x4,%eax
  100ba4:	89 45 14             	mov    %eax,0x14(%ebp)
  100ba7:	8b 45 14             	mov    0x14(%ebp),%eax
  100baa:	83 e8 04             	sub    $0x4,%eax
  100bad:	8b 00                	mov    (%eax),%eax
  100baf:	ba 00 00 00 00       	mov    $0x0,%edx
  100bb4:	89 45 d8             	mov    %eax,-0x28(%ebp)
  100bb7:	89 55 dc             	mov    %edx,-0x24(%ebp)
			base = 16;
  100bba:	c7 45 e0 10 00 00 00 	movl   $0x10,-0x20(%ebp)
			goto number;
  100bc1:	eb 1f                	jmp    100be2 <vprintfmt+0x39f>

		// (unsigned) hexadecimal
		case 'x':
			num = getuint(&ap, lflag);
  100bc3:	8b 45 ec             	mov    -0x14(%ebp),%eax
  100bc6:	89 44 24 04          	mov    %eax,0x4(%esp)
  100bca:	8d 45 14             	lea    0x14(%ebp),%eax
  100bcd:	89 04 24             	mov    %eax,(%esp)
  100bd0:	e8 6f fb ff ff       	call   100744 <getuint>
  100bd5:	89 45 d8             	mov    %eax,-0x28(%ebp)
  100bd8:	89 55 dc             	mov    %edx,-0x24(%ebp)
			base = 16;
  100bdb:	c7 45 e0 10 00 00 00 	movl   $0x10,-0x20(%ebp)
		number:
			printnum(putch, putdat, num, base, width, padc);
  100be2:	0f be 55 f7          	movsbl -0x9(%ebp),%edx
  100be6:	8b 45 e0             	mov    -0x20(%ebp),%eax
  100be9:	89 54 24 18          	mov    %edx,0x18(%esp)
  100bed:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  100bf0:	89 54 24 14          	mov    %edx,0x14(%esp)
  100bf4:	89 44 24 10          	mov    %eax,0x10(%esp)
  100bf8:	8b 45 d8             	mov    -0x28(%ebp),%eax
  100bfb:	8b 55 dc             	mov    -0x24(%ebp),%edx
  100bfe:	89 44 24 08          	mov    %eax,0x8(%esp)
  100c02:	89 54 24 0c          	mov    %edx,0xc(%esp)
  100c06:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c09:	89 44 24 04          	mov    %eax,0x4(%esp)
  100c0d:	8b 45 08             	mov    0x8(%ebp),%eax
  100c10:	89 04 24             	mov    %eax,(%esp)
  100c13:	e8 28 fa ff ff       	call   100640 <printnum>
			break;
  100c18:	eb 3b                	jmp    100c55 <vprintfmt+0x412>

		// escaped '%' character
		case '%':
			putch(ch, putdat);
  100c1a:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c1d:	89 44 24 04          	mov    %eax,0x4(%esp)
  100c21:	89 1c 24             	mov    %ebx,(%esp)
  100c24:	8b 45 08             	mov    0x8(%ebp),%eax
  100c27:	ff d0                	call   *%eax
			break;
  100c29:	eb 2a                	jmp    100c55 <vprintfmt+0x412>

		// unrecognized escape sequence - just print it literally
		default:
			putch('%', putdat);
  100c2b:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c2e:	89 44 24 04          	mov    %eax,0x4(%esp)
  100c32:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
  100c39:	8b 45 08             	mov    0x8(%ebp),%eax
  100c3c:	ff d0                	call   *%eax
			for (fmt --; fmt[-1] != '%'; fmt --)
  100c3e:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
  100c42:	eb 04                	jmp    100c48 <vprintfmt+0x405>
  100c44:	83 6d 10 01          	subl   $0x1,0x10(%ebp)
  100c48:	8b 45 10             	mov    0x10(%ebp),%eax
  100c4b:	83 e8 01             	sub    $0x1,%eax
  100c4e:	0f b6 00             	movzbl (%eax),%eax
  100c51:	3c 25                	cmp    $0x25,%al
  100c53:	75 ef                	jne    100c44 <vprintfmt+0x401>
				/* do nothing */;
			break;
		}
	}
  100c55:	90                   	nop
	register int ch, err;
	unsigned long long num;
	int base, width, precision, lflag, altflag;

	while (1) {
		while ((ch = *(unsigned char *)fmt ++) != '%') {
  100c56:	e9 09 fc ff ff       	jmp    100864 <vprintfmt+0x21>
			for (fmt --; fmt[-1] != '%'; fmt --)
				/* do nothing */;
			break;
		}
	}
}
  100c5b:	83 c4 40             	add    $0x40,%esp
  100c5e:	5b                   	pop    %ebx
  100c5f:	5e                   	pop    %esi
  100c60:	5d                   	pop    %ebp
  100c61:	c3                   	ret    

00100c62 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:			the character will be printed
 * @b:			the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
  100c62:	55                   	push   %ebp
  100c63:	89 e5                	mov    %esp,%ebp
	b->cnt ++;
  100c65:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c68:	8b 40 08             	mov    0x8(%eax),%eax
  100c6b:	8d 50 01             	lea    0x1(%eax),%edx
  100c6e:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c71:	89 50 08             	mov    %edx,0x8(%eax)
	if (b->buf < b->ebuf) {
  100c74:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c77:	8b 10                	mov    (%eax),%edx
  100c79:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c7c:	8b 40 04             	mov    0x4(%eax),%eax
  100c7f:	39 c2                	cmp    %eax,%edx
  100c81:	73 12                	jae    100c95 <sprintputch+0x33>
		*b->buf ++ = ch;
  100c83:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c86:	8b 00                	mov    (%eax),%eax
  100c88:	8b 55 08             	mov    0x8(%ebp),%edx
  100c8b:	88 10                	mov    %dl,(%eax)
  100c8d:	8d 50 01             	lea    0x1(%eax),%edx
  100c90:	8b 45 0c             	mov    0xc(%ebp),%eax
  100c93:	89 10                	mov    %edx,(%eax)
	}
}
  100c95:	5d                   	pop    %ebp
  100c96:	c3                   	ret    

00100c97 <snprintf>:
 * @str:		the buffer to place the result into
 * @size:		the size of buffer, including the trailing null space
 * @fmt:		the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
  100c97:	55                   	push   %ebp
  100c98:	89 e5                	mov    %esp,%ebp
  100c9a:	83 ec 28             	sub    $0x28,%esp
	va_list ap;
	int cnt;
	va_start(ap, fmt);
  100c9d:	8d 45 10             	lea    0x10(%ebp),%eax
  100ca0:	83 c0 04             	add    $0x4,%eax
  100ca3:	89 45 f0             	mov    %eax,-0x10(%ebp)
	cnt = vsnprintf(str, size, fmt, ap);
  100ca6:	8b 45 10             	mov    0x10(%ebp),%eax
  100ca9:	8b 55 f0             	mov    -0x10(%ebp),%edx
  100cac:	89 54 24 0c          	mov    %edx,0xc(%esp)
  100cb0:	89 44 24 08          	mov    %eax,0x8(%esp)
  100cb4:	8b 45 0c             	mov    0xc(%ebp),%eax
  100cb7:	89 44 24 04          	mov    %eax,0x4(%esp)
  100cbb:	8b 45 08             	mov    0x8(%ebp),%eax
  100cbe:	89 04 24             	mov    %eax,(%esp)
  100cc1:	e8 08 00 00 00       	call   100cce <vsnprintf>
  100cc6:	89 45 f4             	mov    %eax,-0xc(%ebp)
	va_end(ap);
	return cnt;
  100cc9:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  100ccc:	c9                   	leave  
  100ccd:	c3                   	ret    

00100cce <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
  100cce:	55                   	push   %ebp
  100ccf:	89 e5                	mov    %esp,%ebp
  100cd1:	83 ec 28             	sub    $0x28,%esp
	struct sprintbuf b = {str, str + size - 1, 0};
  100cd4:	8b 45 0c             	mov    0xc(%ebp),%eax
  100cd7:	83 e8 01             	sub    $0x1,%eax
  100cda:	03 45 08             	add    0x8(%ebp),%eax
  100cdd:	8b 55 08             	mov    0x8(%ebp),%edx
  100ce0:	89 55 ec             	mov    %edx,-0x14(%ebp)
  100ce3:	89 45 f0             	mov    %eax,-0x10(%ebp)
  100ce6:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
	if (str == NULL || b.buf > b.ebuf) {
  100ced:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
  100cf1:	74 0a                	je     100cfd <vsnprintf+0x2f>
  100cf3:	8b 55 ec             	mov    -0x14(%ebp),%edx
  100cf6:	8b 45 f0             	mov    -0x10(%ebp),%eax
  100cf9:	39 c2                	cmp    %eax,%edx
  100cfb:	76 07                	jbe    100d04 <vsnprintf+0x36>
		return -E_INVAL;
  100cfd:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  100d02:	eb 2b                	jmp    100d2f <vsnprintf+0x61>
	}
	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  100d04:	b8 62 0c 10 00       	mov    $0x100c62,%eax
  100d09:	8b 55 14             	mov    0x14(%ebp),%edx
  100d0c:	89 54 24 0c          	mov    %edx,0xc(%esp)
  100d10:	8b 55 10             	mov    0x10(%ebp),%edx
  100d13:	89 54 24 08          	mov    %edx,0x8(%esp)
  100d17:	8d 55 ec             	lea    -0x14(%ebp),%edx
  100d1a:	89 54 24 04          	mov    %edx,0x4(%esp)
  100d1e:	89 04 24             	mov    %eax,(%esp)
  100d21:	e8 1d fb ff ff       	call   100843 <vprintfmt>
	// null terminate the buffer
	*b.buf = '\0';
  100d26:	8b 45 ec             	mov    -0x14(%ebp),%eax
  100d29:	c6 00 00             	movb   $0x0,(%eax)
	return b.cnt;
  100d2c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  100d2f:	c9                   	leave  
  100d30:	c3                   	ret    
  100d31:	90                   	nop
  100d32:	90                   	nop
  100d33:	90                   	nop

00100d34 <strlen>:
 * @s:		the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
  100d34:	55                   	push   %ebp
  100d35:	89 e5                	mov    %esp,%ebp
  100d37:	83 ec 10             	sub    $0x10,%esp
	size_t cnt = 0;
  100d3a:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
	while (*s ++ != '\0') {
  100d41:	eb 04                	jmp    100d47 <strlen+0x13>
		cnt ++;
  100d43:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
	size_t cnt = 0;
	while (*s ++ != '\0') {
  100d47:	8b 45 08             	mov    0x8(%ebp),%eax
  100d4a:	0f b6 00             	movzbl (%eax),%eax
  100d4d:	84 c0                	test   %al,%al
  100d4f:	0f 95 c0             	setne  %al
  100d52:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  100d56:	84 c0                	test   %al,%al
  100d58:	75 e9                	jne    100d43 <strlen+0xf>
		cnt ++;
	}
	return cnt;
  100d5a:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
  100d5d:	c9                   	leave  
  100d5e:	c3                   	ret    

00100d5f <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
  100d5f:	55                   	push   %ebp
  100d60:	89 e5                	mov    %esp,%ebp
  100d62:	83 ec 10             	sub    $0x10,%esp
	size_t cnt = 0;
  100d65:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
	while (cnt < len && *s ++ != '\0') {
  100d6c:	eb 04                	jmp    100d72 <strnlen+0x13>
		cnt ++;
  100d6e:	83 45 fc 01          	addl   $0x1,-0x4(%ebp)
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
	size_t cnt = 0;
	while (cnt < len && *s ++ != '\0') {
  100d72:	8b 45 fc             	mov    -0x4(%ebp),%eax
  100d75:	3b 45 0c             	cmp    0xc(%ebp),%eax
  100d78:	73 13                	jae    100d8d <strnlen+0x2e>
  100d7a:	8b 45 08             	mov    0x8(%ebp),%eax
  100d7d:	0f b6 00             	movzbl (%eax),%eax
  100d80:	84 c0                	test   %al,%al
  100d82:	0f 95 c0             	setne  %al
  100d85:	83 45 08 01          	addl   $0x1,0x8(%ebp)
  100d89:	84 c0                	test   %al,%al
  100d8b:	75 e1                	jne    100d6e <strnlen+0xf>
		cnt ++;
	}
	return cnt;
  100d8d:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
  100d90:	c9                   	leave  
  100d91:	c3                   	ret    

00100d92 <memset>:
 * @n:		number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
  100d92:	55                   	push   %ebp
  100d93:	89 e5                	mov    %esp,%ebp
  100d95:	57                   	push   %edi
  100d96:	83 ec 24             	sub    $0x24,%esp
  100d99:	8b 45 0c             	mov    0xc(%ebp),%eax
  100d9c:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
	return __memset(s, c, n);
  100d9f:	0f be 45 d8          	movsbl -0x28(%ebp),%eax
  100da3:	8b 55 08             	mov    0x8(%ebp),%edx
  100da6:	89 55 f0             	mov    %edx,-0x10(%ebp)
  100da9:	88 45 ef             	mov    %al,-0x11(%ebp)
  100dac:	8b 45 10             	mov    0x10(%ebp),%eax
  100daf:	89 45 e8             	mov    %eax,-0x18(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
	int d0, d1;
	asm volatile (
  100db2:	8b 4d e8             	mov    -0x18(%ebp),%ecx
  100db5:	0f b6 45 ef          	movzbl -0x11(%ebp),%eax
  100db9:	8b 55 f0             	mov    -0x10(%ebp),%edx
  100dbc:	89 d7                	mov    %edx,%edi
  100dbe:	f3 aa                	rep stos %al,%es:(%edi)
  100dc0:	89 fa                	mov    %edi,%edx
  100dc2:	89 4d f8             	mov    %ecx,-0x8(%ebp)
  100dc5:	89 55 f4             	mov    %edx,-0xc(%ebp)
			"rep; stosb;"
			: "=&c" (d0), "=&D" (d1)
			: "0" (n), "a" (c), "1" (s)
			: "memory");
	return s;
  100dc8:	8b 45 f0             	mov    -0x10(%ebp),%eax
	while (n -- > 0) {
		*p ++ = c;
	}
	return s;
#endif /* __HAVE_ARCH_MEMSET */
}
  100dcb:	83 c4 24             	add    $0x24,%esp
  100dce:	5f                   	pop    %edi
  100dcf:	5d                   	pop    %ebp
  100dd0:	c3                   	ret    

00100dd1 <memmove>:
 * @n:		number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
  100dd1:	55                   	push   %ebp
  100dd2:	89 e5                	mov    %esp,%ebp
  100dd4:	57                   	push   %edi
  100dd5:	56                   	push   %esi
  100dd6:	83 ec 30             	sub    $0x30,%esp
  100dd9:	8b 45 08             	mov    0x8(%ebp),%eax
  100ddc:	89 45 d0             	mov    %eax,-0x30(%ebp)
  100ddf:	8b 45 0c             	mov    0xc(%ebp),%eax
  100de2:	89 45 cc             	mov    %eax,-0x34(%ebp)
  100de5:	8b 45 10             	mov    0x10(%ebp),%eax
  100de8:	89 45 c8             	mov    %eax,-0x38(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
	if (dst < src) {
  100deb:	8b 45 d0             	mov    -0x30(%ebp),%eax
  100dee:	3b 45 cc             	cmp    -0x34(%ebp),%eax
  100df1:	73 42                	jae    100e35 <memmove+0x64>
  100df3:	8b 45 d0             	mov    -0x30(%ebp),%eax
  100df6:	89 45 e8             	mov    %eax,-0x18(%ebp)
  100df9:	8b 45 cc             	mov    -0x34(%ebp),%eax
  100dfc:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  100dff:	8b 45 c8             	mov    -0x38(%ebp),%eax
  100e02:	89 45 e0             	mov    %eax,-0x20(%ebp)
			"andl $3, %%ecx;"
			"jz 1f;"
			"rep; movsb;"
			"1:"
			: "=&c" (d0), "=&D" (d1), "=&S" (d2)
			: "0" (n / 4), "g" (n), "1" (dst), "2" (src)
  100e05:	8b 45 e0             	mov    -0x20(%ebp),%eax
  100e08:	89 c1                	mov    %eax,%ecx
  100e0a:	c1 e9 02             	shr    $0x2,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
	int d0, d1, d2;
	asm volatile (
  100e0d:	8b 55 e8             	mov    -0x18(%ebp),%edx
  100e10:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  100e13:	89 d7                	mov    %edx,%edi
  100e15:	89 c6                	mov    %eax,%esi
  100e17:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  100e19:	8b 4d e0             	mov    -0x20(%ebp),%ecx
  100e1c:	83 e1 03             	and    $0x3,%ecx
  100e1f:	74 02                	je     100e23 <memmove+0x52>
  100e21:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  100e23:	89 f0                	mov    %esi,%eax
  100e25:	89 fa                	mov    %edi,%edx
  100e27:	89 4d f4             	mov    %ecx,-0xc(%ebp)
  100e2a:	89 55 f0             	mov    %edx,-0x10(%ebp)
  100e2d:	89 45 ec             	mov    %eax,-0x14(%ebp)
			"rep; movsb;"
			"1:"
			: "=&c" (d0), "=&D" (d1), "=&S" (d2)
			: "0" (n / 4), "g" (n), "1" (dst), "2" (src)
			: "memory");
	return dst;
  100e30:	8b 45 e8             	mov    -0x18(%ebp),%eax
  100e33:	eb 2f                	jmp    100e64 <memmove+0x93>
	asm volatile (
			"std;"
			"rep; movsb;"
			"cld;"
			: "=&c" (d0), "=&S" (d1), "=&D" (d2)
			: "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
  100e35:	8b 45 c8             	mov    -0x38(%ebp),%eax
  100e38:	83 e8 01             	sub    $0x1,%eax
  100e3b:	89 c2                	mov    %eax,%edx
  100e3d:	03 55 cc             	add    -0x34(%ebp),%edx
  100e40:	8b 45 c8             	mov    -0x38(%ebp),%eax
  100e43:	83 e8 01             	sub    $0x1,%eax
  100e46:	03 45 d0             	add    -0x30(%ebp),%eax
__memmove(void *dst, const void *src, size_t n) {
	if (dst < src) {
		return __memcpy(dst, src, n);
	}
	int d0, d1, d2;
	asm volatile (
  100e49:	8b 4d c8             	mov    -0x38(%ebp),%ecx
  100e4c:	89 d6                	mov    %edx,%esi
  100e4e:	89 c7                	mov    %eax,%edi
  100e50:	fd                   	std    
  100e51:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  100e53:	fc                   	cld    
  100e54:	89 f8                	mov    %edi,%eax
  100e56:	89 f2                	mov    %esi,%edx
  100e58:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  100e5b:	89 55 d8             	mov    %edx,-0x28(%ebp)
  100e5e:	89 45 d4             	mov    %eax,-0x2c(%ebp)
			"rep; movsb;"
			"cld;"
			: "=&c" (d0), "=&S" (d1), "=&D" (d2)
			: "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
			: "memory");
	return dst;
  100e61:	8b 45 d0             	mov    -0x30(%ebp),%eax
			*d ++ = *s ++;
		}
	}
	return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
  100e64:	83 c4 30             	add    $0x30,%esp
  100e67:	5e                   	pop    %esi
  100e68:	5f                   	pop    %edi
  100e69:	5d                   	pop    %ebp
  100e6a:	c3                   	ret    

00100e6b <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
  100e6b:	55                   	push   %ebp
  100e6c:	89 e5                	mov    %esp,%ebp
  100e6e:	57                   	push   %edi
  100e6f:	56                   	push   %esi
  100e70:	83 ec 20             	sub    $0x20,%esp
  100e73:	8b 45 08             	mov    0x8(%ebp),%eax
  100e76:	89 45 e8             	mov    %eax,-0x18(%ebp)
  100e79:	8b 45 0c             	mov    0xc(%ebp),%eax
  100e7c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  100e7f:	8b 45 10             	mov    0x10(%ebp),%eax
  100e82:	89 45 e0             	mov    %eax,-0x20(%ebp)
			"andl $3, %%ecx;"
			"jz 1f;"
			"rep; movsb;"
			"1:"
			: "=&c" (d0), "=&D" (d1), "=&S" (d2)
			: "0" (n / 4), "g" (n), "1" (dst), "2" (src)
  100e85:	8b 45 e0             	mov    -0x20(%ebp),%eax
  100e88:	89 c1                	mov    %eax,%ecx
  100e8a:	c1 e9 02             	shr    $0x2,%ecx
#ifndef __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMCPY
static inline void *
__memcpy(void *dst, const void *src, size_t n) {
	int d0, d1, d2;
	asm volatile (
  100e8d:	8b 55 e8             	mov    -0x18(%ebp),%edx
  100e90:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  100e93:	89 d7                	mov    %edx,%edi
  100e95:	89 c6                	mov    %eax,%esi
  100e97:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  100e99:	8b 4d e0             	mov    -0x20(%ebp),%ecx
  100e9c:	83 e1 03             	and    $0x3,%ecx
  100e9f:	74 02                	je     100ea3 <memcpy+0x38>
  100ea1:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  100ea3:	89 f0                	mov    %esi,%eax
  100ea5:	89 fa                	mov    %edi,%edx
  100ea7:	89 4d f4             	mov    %ecx,-0xc(%ebp)
  100eaa:	89 55 f0             	mov    %edx,-0x10(%ebp)
  100ead:	89 45 ec             	mov    %eax,-0x14(%ebp)
			"rep; movsb;"
			"1:"
			: "=&c" (d0), "=&D" (d1), "=&S" (d2)
			: "0" (n / 4), "g" (n), "1" (dst), "2" (src)
			: "memory");
	return dst;
  100eb0:	8b 45 e8             	mov    -0x18(%ebp),%eax
	while (n -- > 0) {
		*d ++ = *s ++;
	}
	return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
  100eb3:	83 c4 20             	add    $0x20,%esp
  100eb6:	5e                   	pop    %esi
  100eb7:	5f                   	pop    %edi
  100eb8:	5d                   	pop    %ebp
  100eb9:	c3                   	ret    
